package com.funong.matrix.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

@Getter
@AllArgsConstructor
public enum StatusEnum {
    /**
     * 有效状态
     */
    ENABLE(1, "启用"),
    DISABLE(0, "禁用");

    private Integer value;
    private String desc;

    public static StatusEnum valueOf(Integer value) {
        return Arrays.stream(values())
                .filter(statusEnum -> Objects.equals(value, statusEnum.desc))
                .findFirst()
                .orElse(ENABLE);
    }
}
